package com.ww.springboot.boot.baseTest.design.guanchazhe.demo1.server;

import java.util.ArrayList;
import java.util.List;

/**
 * 游戏服务
 *
 * @author wanwei
 * @since 2021-04-23 09:42
 */
public class GameServer {

    /**
     * 注册人名单
     */
    List<Person> people = new ArrayList<>();


    public void add(Person person) {
        people.add(person);
    }

    public void remove(Person person) {
        people.remove(person);
    }

    public void inform() {
        System.out.println("---------开始通知------------");
        people.forEach(person -> person.inform("123"));
        System.out.println("---------停止通知------------");
    }

}
